package week03;
import java.util.Scanner;

	


	class Person {
		private String name;
		private int age;
		private boolean gender;
		private int id;
		private static int count = 0;
		
		
		public Person(String name,int age,boolean gender){
			id = count++;
			this.name = name;
			this.gender = gender;
			this.age = age;
		}
		
		public Person(){
			id=count++;
			System.out.println("This is constructor");
			System.out.printf("%s,%d,%s,%d%n",name,age,gender,id);

		}
		
		public void setName(String name){
			this.name = name;
		}
		
		public String GetName(){
			return name;
		}
		
		public void setage(int age){
			this.age = age;
		}
		
		public int Getage(){
			return age;
		}
		
		public void setgender(boolean gender){
			this.gender = gender;
		}
		
		public boolean Getgender(){
			return gender;
		}
		
		
		public static void Init(){
			System.out.print("This is static initialization block"+'\n');
		}
		
		static{
			Init();
		}
		
		{
			System.out.println("This is initialization block, id is "+count);
		}
		
		
		public String toString(){
			return String.format("Person [name=%s, age=%d, gender=%s, id=%d]",name,age,gender,id);
		}
		
		public static void main(String[] args){
			Scanner in = new Scanner(System.in );
			int n = Integer.parseInt(in.nextLine());
			Person[] persons = new Person[n];
			for(int j = 0;j<persons.length;j++){
				Person person = new Person(in.next(),in.nextInt(),in.nextBoolean());
				persons[j] = person;
			}
			for(int i = persons.length-1;i>=0;i--){
				System.out.println(persons[i]);
			}
			System.out.println(new Person());
		}

	}
public class the03 {
	
		public static void main(String[] args){
			Scanner in = new Scanner(System.in );
			int n = Integer.parseInt(in.nextLine());
			Person[] persons = new Person[n];
			for(int j = 0;j<persons.length;j++){
				Person person = new Person(in.next(),in.nextInt(),in.nextBoolean());
				persons[j] = person;
			}
			for(int i = persons.length-1;i>=0;i--){
				System.out.println(persons[i]);
			}
			System.out.println(new Person());
		}


	}

